﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace QuickGet.EntityFrameworkCore.Sqlite.Migrations
{
    /// <inheritdoc />
    public partial class Add_20241211 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "SavePath",
                table: "Packages");

            migrationBuilder.RenameColumn(
                name: "PackageVersion",
                table: "Packages",
                newName: "NormalizedPackageId");

            migrationBuilder.CreateTable(
                name: "PackageVersions",
                columns: table => new
                {
                    Id = table.Column<long>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    PackageId = table.Column<string>(type: "TEXT", nullable: false),
                    PackageVersion = table.Column<string>(type: "TEXT", nullable: false),
                    SavePath = table.Column<string>(type: "TEXT", nullable: true),
                    Created = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
                    LastModified = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PackageVersions", x => x.Id);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "PackageVersions");

            migrationBuilder.RenameColumn(
                name: "NormalizedPackageId",
                table: "Packages",
                newName: "PackageVersion");

            migrationBuilder.AddColumn<string>(
                name: "SavePath",
                table: "Packages",
                type: "TEXT",
                nullable: true);
        }
    }
}
